﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PQ.Util;
using System.Threading;
using PQ;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
           // Options o = new Options();
            
            Configuration cfg = new Configuration();
            cfg.sampleFreq = 5000.0;
            cfg.triggerMode = USB1612M.SoftwareTrigger;
            USB1612M u = USB1612M.getUSB1612M(cfg);
            Console.WriteLine(u.OpenDevice());
            Thread sampleThread = new Thread(new ThreadStart(cfg.genData));
                //线程优先级设为最高
                sampleThread.Priority = ThreadPriority.Highest;
                sampleThread.Start();
                DateTime preDT = DateTime.Now; ;
                PQAlgo pqAlgo = new PQAlgo(cfg, new AccessUtil(@"F:/aa.mdb"));
                pqAlgo.run();
                while (true)
                {
                    if (cfg.dataExchange.Count != 0)
                    {

                        Console.WriteLine("remove at 0 ,count" + cfg.dataExchange.Count + "!");
                        DateTime now = DateTime.Now;
                        Console.WriteLine(now.Millisecond - preDT.Millisecond);
                        preDT = now;
                        cfg.dataExchange.RemoveAt(0);
                    }
                    else
                    {

                        Thread.Sleep(100);
                    }
                }
            
           
        }
    }
}
